@layout("/common/_container.html"){
<div class="ibox float-e-margins slim-margin">
    <div class="ibox-content">
        <div class="form-horizontal" id="data-input">

            <div class="row">
                <div class="col-sm-6 b-r">
                	<div class="form-group">
	                	<label class="col-sm-3 control-label">发货人名称</label>
	                	<div class="col-sm-9">
	                		<input id="shipper" class="form-control" name="shipper" v-model="item.shipper" minlength="1" required/>
	                	</div>
                	</div>                	
                	<div class="form-group">
	                	<label class="col-sm-3 control-label">发货人电话</label>
	                	<div class="col-sm-9">
	                		<input id="shipperPhone" class="form-control" name="shipperPhone" v-model="item.shipperPhone" minlength="" required/>
	                	</div>
                	</div>
                	<div class="form-group">
	                	<label class="col-sm-3 control-label">发货地址</label>
	                	<div class="col-sm-9">
	                		<input id="origin" class="form-control" name="origin" v-model="item.origin" minlength="2" required/>
	                	</div>
                	</div>
                	<div class="form-group">
	                	<label class="col-sm-3 control-label">发货省市区</label>
	                	<div class="col-sm-9">
	                		<input id="originProvince" class="form-control" name="originProvince" v-model="item.originProvince" minlength="2" required/>
	                	</div>
                	</div> 
                	
                	
                	
                	
                </div>

                <div class="col-sm-6">
                
                	<div class="form-group">
	                	<label class="col-sm-3 control-label">收货人名称</label>
	                	<div class="col-sm-9">
	                		<input id="consignee" class="form-control" name="consignee" v-model="item.consignee" minlength="1" required/>
	                	</div>
                	</div> 
                	<div class="form-group">
	                	<label class="col-sm-3 control-label">收货人电话</label>
	                	<div class="col-sm-9">
	                		<input id="consigneePhone" class="form-control" name="consigneePhone" v-model="item.consigneePhone" minlength="" required/>
	                	</div>
                	</div> 
                	<div class="form-group">
	                	<label class="col-sm-3 control-label">目的地</label>
	                	<div class="col-sm-9">
	                		<input id="destination" class="form-control" name="destination" v-model="item.destination" minlength="2" required/>
	                	</div>
                	</div> 
                	<div class="form-group">
	                	<label class="col-sm-3 control-label">收货省市区</label>
	                	<div class="col-sm-9">
	                		<input id="destinationProvince" class="form-control" name="destinationProvince" v-model="item.destinationProvince" minlength="2" required/>
	                	</div>
                	</div> 
                	
                </div>
            </div>
			<div class="hr-line-dashed"></div>
			<div class="row btn-group-m-t">
				<div class="col-sm-6">
                	<div class="form-group">
	                	<label class="col-sm-3 control-label">货物</label>
	                	<div class="col-sm-6">
	                		<input id="cargo" class="form-control" name="cargo" v-model="item.cargo" minlength="1" required/>
	                	</div>
                	</div> 
                	<div class="form-group">
	                	<label class="col-sm-3 control-label">数量/件</label>
	                	<div class="col-sm-6">
	                		<input id="numbers" class="form-control" name="number" v-model="item.number" minlength="1" required/>
	                	</div>
                	</div> 
	                <div class="form-group">
	                	<label class="col-sm-3 control-label">重量/kg</label>
	                	<div class="col-sm-6">
	                		<input id="weight" class="form-control" name="weight" v-model="item.weight" minlength="1" required/>
	                	</div>
                	</div> 
                	<div class="form-group">
	                	<label class="col-sm-3 control-label">体积</label>
	                	<div class="col-sm-6">
	                		<input id="volume" class="form-control" name="volume" v-model="item.volume" minlength="1" required/>
	                	</div>
                	</div> 
                </div>
            </div>
            <div class="hr-line-dashed"></div>
			
            <div class="row btn-group-m-t">
                <div class="col-sm-10">
                    <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="submitForm();"/>
                    <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="parent.layer.close(parent.layer.getFrameIndex(window.name));"/>
                </div>
            </div>
        </div>

    </div>
</div>
<script>
function submitForm(){
	$("#data-input").bootstrapValidator('validate');
	if($("#data-input").data('bootstrapValidator').isValid()){
		$.ajax({
			url:"/platform/save",
			data:{"object":JSON.stringify(vm.item)},
			type:"POST",
			success:function(){
				if(vm.item.id!=""&&vm.item.id!=undefined&&vm.item.id!=null){
					parent.vm.$set(parent.vm.tableData,parent.selectIndex,vm.item);
				}else{
					parent.vm.loadData();
				}
				parent.layer.msg("操作成功！");
				parent.layer.close(parent.layer.getFrameIndex(window.name));
			},
			error:function(){
				layer.msg("出错了！");
			}
		})
	}
}

var vm=new Vue({
	el:"#data-input",
	data () {
		return {
			item: {},
		}
	},
})
@if(has(id)){
	$.ajax({
		url:"/platform/"+'${id}',
		type:"GET",
		success:function(result){
			vm.item=result;
		},
		error:function(){
			layer.msg("出错了！");
		}
	})
@}
</script>
@}
